package com.fs.client.oauth2.authorize.provider;

import com.fs.client.oauth2.authorize.AuthorizeConfigProvider;

import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

/**
 * @author pangps
 * @version 创建时间：2018年1月31日 下午9:11:36 类说明 白名单
 */
@Component
@Order(Integer.MAX_VALUE - 1)
public class AuthAuthorizeConfigProvider implements AuthorizeConfigProvider {


	@Override
	public boolean config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
		// 免token登录设置
		config.antMatchers().permitAll();
		//前后分离时需要带上
		config.antMatchers(HttpMethod.OPTIONS).permitAll();
		return true;
	}

}
